package org.hl7.datatypes.r2.basic;

import java.util.Arrays;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.FetchType;
import javax.persistence.Lob;
import org.hl7.datatypes.r2.flavors.bl.BN;
import org.hl7.datatypes.r2.foundation.ANY;
import org.hl7.datatypes.r2.foundation.BL;
import org.hl7.datatypes.r2.foundation.LIST;

@Embeddable
public class BIN extends LIST<BN> {

    private static final long serialVersionUID = 1L;
    
    @Column
    @Lob
    @Basic(fetch = FetchType.LAZY)
    private byte[] binValue;

    public byte[] getBinValue() {
        return binValue;
    }

    public void setBinValue(byte[] binValue) {
        this.binValue = binValue;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 29 * hash + Arrays.hashCode(this.binValue);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final BIN other = (BIN) obj;
        if (!Arrays.equals(this.binValue, other.binValue)) {
            return false;
        }
        return true;
    }

    @Override
    public BL equal(ANY x) {
       return new BL(equals(x));
    }

    
}
